package sis.studentinfo;

import java.io.Serializable;

public class Course implements Serializable{

	private static final long serialVersionUID = -2845996028141911532L;
	private String dept;
	private String number;
	
	@Override
	public int hashCode() {
		final int hashMultiplier = 41;
		int result = 7;
		result = result * hashMultiplier + dept.hashCode();
		result = result * hashMultiplier + number.hashCode();
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if(obj == null) {
			return false;
		}
		if(this.getClass() != obj.getClass()) {			//don't use "instanceof", hierarchy
			return false;
		}
		Course other = (Course) obj;
		return this.dept.equals(other.dept) &&
				this.number.equals(other.number);
	}
	
	@Override
	public String toString() {
		return dept + " " + number; 
	}

	public Course(String dept, String number) {
		this.dept = dept;
		this.number = number;
	}

	public String getDepartment() {
		return this.dept;
	}

	public String getNumber() {
		return this.number;
	}

}
